package org.zerta.troops.client;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.zerta.troops.common.Strings;

public class InfoPanel extends JPanel implements ActionListener {

	static final long serialVersionUID = 1L;

    GameController controller;

	InfoPanel(GameController c) {
		controller = c;

		setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

		JLabel label = new JLabel("Info panel");
		add(label);
	
		JButton endTurnButton = new JButton(Strings.Actions.END_TURN_TEXT);
		endTurnButton.setActionCommand(Strings.Actions.END_TURN);
		endTurnButton.addActionListener(this);
		add(endTurnButton);
	}
	public void actionPerformed(ActionEvent e) {
		String command = e.getActionCommand();
		
		if (Strings.Actions.END_TURN.equals(command)) {
			controller.endTurn();
		}
	}
}
